


import 'package:bike_ride/api/common_repository.dart';
import 'package:bike_ride/common/mvvm/base_view_model.dart';
import 'package:bike_ride/common/widget/notifier_widget.dart';
import 'package:bike_ride/model/question/model/question_m.dart';
import 'package:bike_ride/model/question/view/question_v.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';

class QuestionViewModel extends PageViewModel<QuestionViewState> {
  CancelToken? cancelToken;
  ValueNotifier<List<QuestionM>> helpList = ValueNotifier<List<QuestionM>>(List.empty());


  @override
  onCreate() {
    cancelToken = CancelToken();
    pageDataModel = PageDataModel();
    getHelpList();
  }

  @override
  onDispose() {
    if (!(cancelToken?.isCancelled ?? true)) {
      cancelToken?.cancel();
    }
    super.onDispose();
  }


  Future getHelpList() async {
    final result = await CommonRepository.getHelpListIdl();
    helpList.value = result;
    state.notifyChange();
  }

  /// 请求数据
  @override
  Future<PageViewModel?> requestData({Map<String, dynamic>? params}) async {
    return null;

  }
}